<?php 
$user = elgg_get_page_owner_entity();
$golf_handicaps = elgg_get_golf_handicap(array('user_entity_id' => $user->guid));
$golf_handicap == null;
if(isset($golf_handicaps) && count($golf_handicaps) >= 1) {
	$golf_handicap = $golf_handicaps[0];
	$handicap_index = $golf_handicap->handicap_index;
} else {
	$handicap_index = -1;
}
$options = array(
		'offset'     => (int) max(get_input('offset', 0), 0),
		'limit'      => (int) max(get_input('limit', 20), 0),
		'user_entity_id' => $user->guid,
		'active_flg' => 1,
);
$options['count'] = TRUE;
$count = elgg_get_golf_score($options);
$options['count'] = FALSE;
$options['average'] = TRUE;
$options['average_column'] = 'total_score';
$average = elgg_get_golf_score($options);
?>
	<div class='golfscore-profile'>
	<h5>Last 20 Scores:</h5>
	<div class='golfscore_point g1'>
	<b><?php if($handicap_index >= 0) echo $handicap_index; else echo "--";?></b><span>Handicap</span>
	</div>
	<div class='golfscore_point g2'>
	<b><?php if($average > 0) echo number_format($average, 1); else echo '0';?></b><span>Score Avg</span>
	</div>
	<div class='golfscore_point g3'>
	<b><?php if($count > 0) echo $count; else echo '0';?></b><span>Scores Entered</span>
	</div>
	</div>
